﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Presentation;
using StatisticCalculatorApplication;
namespace WPFView
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window, IView
    {
        private readonly LogView logBrowser;
        public MainWindow()
        {
            InitializeComponent();
            logBrowser = new LogView { Visibility = System.Windows.Visibility.Hidden };
            var application = new StatsApplication();
            application.start(this);

        }

        public string SampleData
        {
            get
            {
                return textBoxSampleData.Text;
            }
            set
            {
                textBoxSampleData.Text = value;
            }
        }

        public string ExpectedValueUniformDistribution
        {
            get
            {
                return labelMathematicalExpectation.ContentStringFormat;
            }
            set
            {
                labelMathematicalExpectation.Content = value;
            }
        }

        public string VarianceUniformDistribution
        {
            get
            {
                return labelVariance.ContentStringFormat;
            }
            set
            {
                labelVariance.Content = value;
            }
        }

        public string SampleMean
        {
            get
            {
                return labelSampleMean.ContentStringFormat;
            }
            set
            {
                labelSampleMean.Content = value;
            }
        }

        public string SampleVariance
        {
            get
            {
                return labelSampleVariance.ContentStringFormat;
            }
            set
            {
                labelSampleVariance.Content = value;
            }
        }

        public string SampleSkewness
        {
            get
            {
                return labelSampleSkewness.ContentStringFormat;
            }
            set
            {
                labelSampleSkewness.Content = value;
            }
        }

        public string SampleKurtosis
        {
            get
            {
                return labelSampleKurtosis.ContentStringFormat;
            }
            set
            {
                labelSampleKurtosis.Content = value;
            }
        }

        public string ErrorMessage
        {
            get
            {
                return errorLabel.ContentStringFormat;
            }
            set
            {
                errorLabel.Content = value;
            }
        }

        public string[] Logs
        {
            set { logBrowser.Logs = value; }
        }
        public Action OnProcessExpectedValueOfUniformDistribution
        { set; private get; }

        public Action OnProcessVarianceOfUniformDistribution
        { set; private get; }

        public Action OnProcessSampleMean
        { set; private get; }
        public Action OnProcessSampleVariance
        { set; private get; }

        public Action OnProcessSampleSkewness
        { set; private get; }

        public Action OnProcessSampleKurtosis
        { set; private get; }

        public Action OnInputData
        { set; private get; }

        public Action OnClearEntries
        { set; private get; }
        public Action OnShowLogs
        { set; private get; }

        private void buttonCalculate_Click(object sender, RoutedEventArgs e)
        {
            OnInputData();
            OnProcessExpectedValueOfUniformDistribution();
            OnProcessVarianceOfUniformDistribution();
            OnProcessSampleMean();
            OnProcessSampleVariance();
            OnProcessSampleVariance();
            OnProcessSampleSkewness();
            OnProcessSampleKurtosis();
        }

        private void buttonClear_Click(object sender, RoutedEventArgs e)
        {
            OnClearEntries();
        }

        private void buttonShowLogs_Click(object sender, RoutedEventArgs e)
        {
            OnShowLogs();
        }
 
    }
}
